package com.caiyigo.baihua.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.springframework.stereotype.Repository;

import com.caiyigo.baihua.dto.CjBean;
import com.caiyigo.baihua.dto.KaoshizwDto;
import com.caiyigo.baihua.dto.KaoshizwDto;
import com.caiyigo.baihua.model.Kaoshizw;
import com.github.miemiedev.mybatis.paginator.domain.PageBounds;

/**
 * @author Administrator
 * 
 */
@Repository
public class KaoshizwMapperSql implements KaoshizwMapper {
	private SqlSessionFactory sqlSessionFactory;

	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		this.sqlSessionFactory = sqlSessionFactory;
	}

	public List getList(KaoshizwDto dto, PageBounds pageBounds) {

		Map<String, Object> params = new HashMap<String, Object>();

		if (!StringUtils.isEmpty(dto.getName())) {
			params.put(KaoshizwDto.FileConstant.NAME, dto.getName());
		}
		if (!StringUtils.isEmpty(dto.getZkz())) {
			params.put(KaoshizwDto.FileConstant.zkz, dto.getZkz());
		}
		if (StringUtils.isNotEmpty(dto.getMobile())) {
			params.put(KaoshizwDto.FileConstant.mobile, dto.getMobile());
		}
		if (!StringUtils.isEmpty(dto.getKaochang())) {
			params.put(KaoshizwDto.FileConstant.kaochang, dto.getKaochang());
		}
		if (!StringUtils.isEmpty(dto.getDizhi())) {
			params.put(KaoshizwDto.FileConstant.dizhi, dto.getDizhi());
		}
		if (!StringUtils.isEmpty(dto.getKemu())) {
			params.put(KaoshizwDto.FileConstant.kemu, dto.getKemu());
		}
		if (!StringUtils.isEmpty(dto.getPici())) {
			params.put(KaoshizwDto.FileConstant.pici, dto.getPici());
		}
		if (!StringUtils.isEmpty(dto.getSshm())) {
			params.put(KaoshizwDto.FileConstant.sshm, dto.getSshm());
		}
		List<Object> list = null;
		SqlSession session = sqlSessionFactory.openSession();
		try {
			list = session.selectList(
					"com.caiyigo.baihua.dao.KaoshizwMapper.list", params,
					pageBounds);
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			session.close();
		}

		return list;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.KaoshizwMapper#deleteByPrimaryKey(java.lang.Integer)
	 */
	@Override
	public int deleteByPrimaryKey(Integer ksId) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.KaoshizwMapper#insert(com.caiyigo.zoo.model.Kaoshizw)
	 */
	@Override
	public int insert(Kaoshizw record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.KaoshizwMapper#insertSelective(com.caiyigo.zoo.model
	 * .Kaoshizw)
	 */
	@Override
	public int insertSelective(Kaoshizw record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.KaoshizwMapper#selectByPrimaryKey(java.lang.Integer)
	 */
	@Override
	public Kaoshizw selectByPrimaryKey(Integer ksId) {
		// TODO Auto-generated method stub
		return null;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.KaoshizwMapper#updateByPrimaryKeySelective(com.caiyigo
	 * .zoo.model.Kaoshizw)
	 */
	@Override
	public int updateByPrimaryKeySelective(Kaoshizw record) {
		// TODO Auto-generated method stub
		return 0;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see
	 * com.caiyigo.zoo.dao.KaoshizwMapper#updateByPrimaryKey(com.caiyigo.zoo
	 * .model.Kaoshizw)
	 */
	@Override
	public int updateByPrimaryKey(Kaoshizw record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int batchDelete(String[] ids) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<KaoshizwDto> getAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int batchUpdate(List<KaoshizwDto> record) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public List<CjBean> smsZwList(String pici) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int updateSmsZwList(Kaoshizw record) {
		// TODO Auto-generated method stub
		return 0;
	}

}
